﻿

namespace Huirui.Cavan.Presentation.Admin
{
    using System;
    using System.Web.Mvc;
    using System.Web.Optimization;
    using System.Web.Routing;
    using FluentValidation.Attributes;
    using FluentValidation.Mvc;
    using Huirui.Cavan.Domain.MainBoundedContext.SearchModule;
    using Spring.Context;
    using Spring.Context.Support;
    using Spring.Web.Mvc;
    using Huirui.Cavan.Core.Helper;
    using Huirui.Cavan.Domain.MainBoundedContext.Setting;
    using Huirui.Cavan.Application.Seedwork;
    

    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : SpringMvcApplication
    {
        protected override void Application_Start(object sender, EventArgs e)
        {
            base.Application_Start(sender, e);

            IApplicationContext context = ContextRegistry.GetContext();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;

            ModelValidatorProviders.Providers.Add(
                new FluentValidationModelValidatorProvider(new AttributedValidatorFactory()));
            
        }
    }
}